﻿using CNav.Domain;
using FluentValidation;

namespace CNav.Business.Validation
{
    public class ProductValidation : AbstractValidator<Product>
    {
        public ProductValidation()
        {
            RuleFor(p => p.Name).NotEmpty().Length(4, 50).WithMessage("Please provide product name atleast 4 and 50 character long");
            RuleFor(p => p.Description).Length(2, 100).WithMessage("Please provide description");
            RuleFor(p => p.Category).NotEmpty().Length(4, 50).WithMessage("Please provide product category atleast 4 and 50 character long");
            RuleFor(p => p.SubCategory).NotEmpty().Length(4, 50).WithMessage("Please provide product sub category atleast 4 and 50 character long");
        }
    }
}